package com.ddc.study.feature.friend;

import com.ddc.study.entity.Friend;
import com.ddc.study.net.NetworkUtil;

import java.util.List;

/**
 * Created on 2018/6/7.
 *
 * @author lshun
 * @version 1.0
 */
class FriendSitePresenter extends FriendSiteContract.IPresenter {
    @Override
    void loadData() {
        Runnable runnable = () -> {
            final List<Friend> data = NetworkUtil.getFriendSite();

            if (!isViewAttached()) return;
            getView().runOnUIThread(() -> {
                if (isViewAttached()) {
                    getView().showData(data);
                }
            });
        };

        mThreadPool.submit(runnable);
    }
}
